home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
TURB_VIS
/
RESDMP11
/
TESTBOX.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1993-07-27
|
3KB
|
119 lines
{$A+,B-,D+,E+,F+,G-,I+,L+,N-,O-,R+,S+,V+,X-}
{$M 16384,0,655360}
{use this as a template to test new dialog boxes}
program testbox;
uses Objects,Drivers,Views,Menus,Dialogs,App,Gadgets;
const
cmAboutDialog = 101;
cmTestDialog = 102;
type
TMyApp = object(TApplication)
Heap: PHeapView;
constructor init;
procedure HandleEvent(var Event: TEvent); virtual;
procedure InitMenuBar; virtual;
procedure InitStatusLine; virtual;
procedure AboutDialog;
procedure TestDialog;
procedure Idle;virtual;
end;
VAR RezFile: TResourceFile;
RezStream: PStream;
CONSTRUCTOR TMyApp.Init;
VAR R : TRect;
BEGIN
RegisterObjects;
RegisterViews;
RegisterMenus;
RegisterDialogs;
RegisterApp;
RegisterType(RStringList);
RezStream := New(PBufStream, Init('TESTBOX.BRS', stOpenRead, 4096));
RezFile.Init(RezStream);
TApplication.Init;
GetExtent(R);
Dec(R.B.X);
R.A.X := R.B.X - 9; R.A.Y := R.B.Y - 1;
Heap := New(PHeapView, Init(R));
Insert(Heap);
END;
procedure TMyApp.HandleEvent(var Event: TEvent);
begin {HandleEvent}
TApplication.HandleEvent(Event);
if (Event.What = evCommand) then
begin
case Event.Command of
cmAboutDialog :
AboutDialog;
cmTestDialog :
TestDialog;
else
Exit;
end;
ClearEvent(Event);
end
end; {HandleEvent}
PROCEDURE TMyApp.Idle;
BEGIN
TApplication.Idle;
Heap^.Update;
END;{PROC TMyApp.Idle}
procedure TMyApp.InitMenuBar;
begin {InitMenuBar}
MenuBar := PMenuBar(RezFile.Get('MAIN_MB'));
end; {InitMenuBar}
procedure TMyApp.InitStatusLine;
begin {InitStatusLine}
StatusLine := PStatusline(RezFile.Get('MAIN_ST'));
end; {InitStatusLine}
procedure TMyApp.AboutDialog;
var Dialog : PDialog;
R : TRect;
C : word;
begin {AboutDialog}
Dialog := PDialog(RezFile.Get('ABOUT_DB'));
C := DeskTop^.ExecView(Dialog);
Dispose(Dialog,Done)
end; {AboutDialog}
procedure TMyApp.TestDialog;
var Dialog : PDialog;
C : word;
begin {AboutDialog}
Dialog := PDialog(RezFile.Get('TESTER_DB'));
C := DeskTop^.ExecView(Dialog);
Dispose(Dialog,Done)
end; {TestDialog}
var
MyApp : TMyApp;
begin {TESTBOX}
MyApp.Init;
MyApp.Run;
MyApp.Done;
end. {TESTBOX}